@echo off
set count=1
set pid=%1

:loop
    echo start switch %count%
    hdc shell uinput -K -d 2010 -u 2010
    timeout /nobreak /t 1
    hdc shell uinput -K -d 2 -u 2
    set /a count+=1
    for /f "tokens=*" %%i in ('hdc shell ps -p %pid%') do (
	    @set process=%%i
    )
    echo %process%
    set subString=mple.camerademo

    echo %process%|findstr %subString% >nul
    if %errorlevel% equ 0 (
        echo "camera not killed "
        goto loop
    ) else (
        echo "camera has killed"
    )
